$(document).ready(function() {
      $("#search_textbox").autocomplete({
   source: "./API/search_autocomplete.php",
   minLength: 2//search after two characters
   /*select: function(event,ui){
    $("search_textbox").value = $value;
    }*/
  });
  $(document).ready(function(){
    $( "#checkin" ).datepicker("setDate","0d");
    $( "#checkout" ).datepicker("setDate","+1d");
  });
    $( "#checkin" ).datepicker("setDate","0d");
    $( "#checkout" ).datepicker("setDate","+1d");
      var todaysDate = new Date();

        $( "#checkin" ).datepicker({
            minDate: "0d",
            maxDate: "+499d",
            onSelect:
                function(selectedDate){
                    if($('#checkin').datepicker('getDate') != null){
                        var currentDate = $('#checkin').datepicker('getDate');
                        currentDate.setDate(currentDate.getDate()+1);
                        $('#checkout').datepicker('option', 'minDate', currentDate);
                        var maxDate= $('#checkin').datepicker('getDate');
                        maxDate.setDate(maxDate.getDate()+27);
                        $('#checkout').datepicker('option', 'maxDate', maxDate);
                    }
                }
        });


        $( "#checkout" ).datepicker({
            minDate: "+1d",
            maxDate: "+500d",
            beforeShow:
                function(selectedDate){
                    if($('#checkin').datepicker('getDate') != null){
                        var currentDate = $('#checkin').datepicker('getDate');
                        currentDate.setDate(currentDate.getDate()+1);
                        $('#checkout').datepicker('option', 'minDate', currentDate);
                        var maxDate= $('#checkin').datepicker('getDate');
                        maxDate.setDate(maxDate.getDate()+27);
                        $('#checkout').datepicker('option', 'maxDate', maxDate);
                    }
                }
        });


});


